package com.zboin.controller;

import com.zboin.common.domain.AjaxResult;
import com.zboin.common.domain.LoginBody;
import com.zboin.framework.serve.LoginServe;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhboom
 * @date 2025/6/10 22:34
 */
@RestController
@RequestMapping
public class LoginController {

    private final LoginServe loginServe;

    public LoginController(LoginServe loginServe) {
        this.loginServe = loginServe;
    }

    @PostMapping("/login")
    public AjaxResult login(@RequestBody LoginBody loginBody) {
        return loginServe.login(loginBody);
    }

    @PostMapping("/logout")
    public AjaxResult logout() {
        loginServe.logout();
        return AjaxResult.success("退出成功");
    }
}
